package xyz.o0o0o.demo.client;

import org.igniterealtime.restclient.RestApiClient;
import org.igniterealtime.restclient.entity.AuthenticationToken;
import org.igniterealtime.restclient.entity.UserEntities;
import org.igniterealtime.restclient.entity.UserEntity;

import com.alibaba.fastjson.JSON;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args )
    {
        System.out.println( "Hello World!" );
        
        // Set Shared secret key
        AuthenticationToken authenticationToken = new AuthenticationToken("yu4sAn6eV065N2Cj");
        // Set Openfire settings (9090 is the port of Openfire Admin Console)
        RestApiClient restApiClient = new RestApiClient("http://localhost", 9090, authenticationToken);

        // Request all available users
        UserEntities users = restApiClient.getUsers();
        
        
        for (UserEntity user : users.getUsers()) {
        	System.out.println(JSON.toJSONString(user));
		}
        
        
    }
}
